import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import router from './router'
import App from './App.vue'
import './style.css'
import './styles/responsive.css'
import './styles/common.css'
import { logUtils, SIMULATION_STATUS, STATUS_TYPES } from './utils/common'
import i18n from './i18n'

const app = createApp(App)
const pinia = createPinia()

// 先使用pinia
app.use(pinia)

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

// 全局注册
app.config.globalProperties.$router = router
app.config.globalProperties.$logUtils = logUtils
app.config.globalProperties.$SIMULATION_STATUS = SIMULATION_STATUS
app.config.globalProperties.$STATUS_TYPES = STATUS_TYPES

app.use(router)
app.use(ElementPlus)
app.use(i18n)

app.mount('#app')